package com.itheima.health.controller;

import com.itheima.health.entity.Result;
import com.itheima.health.service.MobileValidateCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 验证码Controller
 */
@RestController
@RequestMapping("/mobile/validateCode")
@Slf4j
@Api(tags = "手机端验证码接口")
public class MobileValidateCodeController {
    @Autowired
    private MobileValidateCodeService mobileValidateCodeService;

    @PostMapping("/send")
    @ApiOperation("发送验证码")
    public Result send(@RequestParam String type, @RequestParam String telephone){
        String code = mobileValidateCodeService.send(type, telephone);
        return Result.success(code);
    }
}
